﻿using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

namespace suirui.ZhuMu.Entity.Migrations
{
    public partial class _122901 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropPrimaryKey(
                name: "PK_user",
                table: "user");

            migrationBuilder.RenameTable(
                name: "user",
                newName: "User");

            migrationBuilder.AlterColumn<short>(
                name: "Role",
                table: "User",
                nullable: false,
                oldClrType: typeof(short),
                oldType: "smallint",
                oldComment: "角色");

            migrationBuilder.AlterColumn<string>(
                name: "Remark",
                table: "User",
                maxLength: 200,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "varchar(255)",
                oldMaxLength: 200,
                oldNullable: true,
                oldDefaultValueSql: "''",
                oldComment: "备注");

            migrationBuilder.AlterColumn<string>(
                name: "Phone",
                table: "User",
                maxLength: 15,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "varchar(20)",
                oldMaxLength: 15,
                oldDefaultValueSql: "''",
                oldComment: "手机号");

            migrationBuilder.AlterColumn<string>(
                name: "Password",
                table: "User",
                maxLength: 30,
                nullable: false,
                oldClrType: typeof(string),
                oldType: "varchar(30)",
                oldMaxLength: 30,
                oldDefaultValueSql: "''",
                oldComment: "登录密码");

            migrationBuilder.AlterColumn<string>(
                name: "Name",
                table: "User",
                maxLength: 30,
                nullable: false,
                oldClrType: typeof(string),
                oldType: "varchar(30)",
                oldMaxLength: 30,
                oldDefaultValueSql: "''",
                oldComment: "用户名");

            migrationBuilder.AlterColumn<string>(
                name: "HeadPhoto",
                table: "User",
                nullable: true,
                oldClrType: typeof(string),
                oldType: "text",
                oldNullable: true,
                oldComment: "头像路径");

            migrationBuilder.AlterColumn<long>(
                name: "Id",
                table: "User",
                nullable: false,
                oldClrType: typeof(long),
                oldType: "bigint",
                oldComment: "登录的用户ID")
                .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn)
                .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);

            migrationBuilder.AlterColumn<string>(
                name: "VaccinationPhoto",
                table: "Health",
                maxLength: 200,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "varchar(300) CHARACTER SET utf8mb4",
                oldMaxLength: 300,
                oldNullable: true);

            migrationBuilder.AlterColumn<string>(
                name: "TouchPatientDetail",
                table: "Health",
                maxLength: 200,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "varchar(300) CHARACTER SET utf8mb4",
                oldMaxLength: 300,
                oldNullable: true);

            migrationBuilder.AlterColumn<string>(
                name: "TouchFeverDetail",
                table: "Health",
                maxLength: 200,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "varchar(300) CHARACTER SET utf8mb4",
                oldMaxLength: 300,
                oldNullable: true);

            migrationBuilder.AlterColumn<string>(
                name: "SeeDoctorRecord",
                table: "Health",
                maxLength: 200,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "varchar(300) CHARACTER SET utf8mb4",
                oldMaxLength: 300,
                oldNullable: true);

            migrationBuilder.AlterColumn<string>(
                name: "GoPublicPlaceDetail",
                table: "Health",
                maxLength: 200,
                nullable: true,
                oldClrType: typeof(string),
                oldType: "varchar(300) CHARACTER SET utf8mb4",
                oldMaxLength: 300,
                oldNullable: true);

            migrationBuilder.AddPrimaryKey(
                name: "PK_User",
                table: "User",
                column: "Id");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropPrimaryKey(
                name: "PK_User",
                table: "User");

            migrationBuilder.RenameTable(
                name: "User",
                newName: "user");

            migrationBuilder.AlterColumn<short>(
                name: "Role",
                table: "user",
                type: "smallint",
                nullable: false,
                comment: "角色",
                oldClrType: typeof(short));

            migrationBuilder.AlterColumn<string>(
                name: "Remark",
                table: "user",
                type: "varchar(255)",
                maxLength: 200,
                nullable: true,
                defaultValueSql: "''",
                comment: "备注",
                oldClrType: typeof(string),
                oldMaxLength: 200,
                oldNullable: true);

            migrationBuilder.AlterColumn<string>(
                name: "Phone",
                table: "user",
                type: "varchar(20)",
                maxLength: 15,
                nullable: false,
                defaultValueSql: "''",
                comment: "手机号",
                oldClrType: typeof(string),
                oldMaxLength: 15,
                oldNullable: true);

            migrationBuilder.AlterColumn<string>(
                name: "Password",
                table: "user",
                type: "varchar(30)",
                maxLength: 30,
                nullable: false,
                defaultValueSql: "''",
                comment: "登录密码",
                oldClrType: typeof(string),
                oldMaxLength: 30);

            migrationBuilder.AlterColumn<string>(
                name: "Name",
                table: "user",
                type: "varchar(30)",
                maxLength: 30,
                nullable: false,
                defaultValueSql: "''",
                comment: "用户名",
                oldClrType: typeof(string),
                oldMaxLength: 30);

            migrationBuilder.AlterColumn<string>(
                name: "HeadPhoto",
                table: "user",
                type: "text",
                nullable: true,
                comment: "头像路径",
                oldClrType: typeof(string),
                oldNullable: true);

            migrationBuilder.AlterColumn<long>(
                name: "Id",
                table: "user",
                type: "bigint",
                nullable: false,
                comment: "登录的用户ID",
                oldClrType: typeof(long))
                .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn)
                .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);

            migrationBuilder.AlterColumn<string>(
                name: "VaccinationPhoto",
                table: "Health",
                type: "varchar(300) CHARACTER SET utf8mb4",
                maxLength: 300,
                nullable: true,
                oldClrType: typeof(string),
                oldMaxLength: 200,
                oldNullable: true);

            migrationBuilder.AlterColumn<string>(
                name: "TouchPatientDetail",
                table: "Health",
                type: "varchar(300) CHARACTER SET utf8mb4",
                maxLength: 300,
                nullable: true,
                oldClrType: typeof(string),
                oldMaxLength: 200,
                oldNullable: true);

            migrationBuilder.AlterColumn<string>(
                name: "TouchFeverDetail",
                table: "Health",
                type: "varchar(300) CHARACTER SET utf8mb4",
                maxLength: 300,
                nullable: true,
                oldClrType: typeof(string),
                oldMaxLength: 200,
                oldNullable: true);

            migrationBuilder.AlterColumn<string>(
                name: "SeeDoctorRecord",
                table: "Health",
                type: "varchar(300) CHARACTER SET utf8mb4",
                maxLength: 300,
                nullable: true,
                oldClrType: typeof(string),
                oldMaxLength: 200,
                oldNullable: true);

            migrationBuilder.AlterColumn<string>(
                name: "GoPublicPlaceDetail",
                table: "Health",
                type: "varchar(300) CHARACTER SET utf8mb4",
                maxLength: 300,
                nullable: true,
                oldClrType: typeof(string),
                oldMaxLength: 200,
                oldNullable: true);

            migrationBuilder.AddPrimaryKey(
                name: "PK_user",
                table: "user",
                column: "Id");
        }
    }
}
